namespace Teamwish.Domain.Models
{
    using System;
    using System.Data.Entity;

    public partial class EfDbContext : DbContext
    {
        public EfDbContext()
            : base("name=EFDbContext")
        {
            Database.Log = Console.Write;
            
        }
       
        public virtual DbSet<Attributes> Attributes { get; set; }
        public virtual DbSet<Category> Category { get; set; }
        public virtual DbSet<OrderItem> OrderItem { get; set; }
        public virtual DbSet<Orders> Orders { get; set; }
        public virtual DbSet<Product> Product { get; set; }
        public virtual DbSet<ProductAttribute> ProductAttribute { get; set; }
        public virtual DbSet<ProductComment> ProductComment { get; set; }
        public virtual DbSet<Userinfo> Userinfo { get; set; }
        public virtual DbSet<Course> Course { get; set; }
        public virtual DbSet<UserCourse> UserCourse { get; set; }
        public virtual DbSet<UserinfoDetail> UserinfoDetails { get; set; }
        public virtual DbSet<Banner> Banner { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Entity<Attributes>()
                .Property(e => e.Name)
                .IsUnicode(false);

            modelBuilder.Entity<Attributes>()
                .Property(e => e.Text)
                .IsUnicode(false);

            modelBuilder.Entity<Attributes>()
                .Property(e => e.DataType)
                .IsUnicode(false);

            modelBuilder.Entity<Attributes>()
                .Property(e => e.Unit)
                .IsUnicode(false);

            modelBuilder.Entity<Attributes>()
                .Property(e => e.Remark)
                .IsUnicode(false);

            modelBuilder.Entity<Category>()
                .Property(e => e.Name)
                .IsUnicode(false);

            modelBuilder.Entity<Category>()
                .Property(e => e.Remark)
                .IsUnicode(false);

            modelBuilder.Entity<Category>()
                .HasMany(e => e.Category1)
                .WithOptional(e => e.Category2)
                .HasForeignKey(e => e.Pid);

            modelBuilder.Entity<Orders>()
                .Property(e => e.OrderNo)
                .IsUnicode(false);

            modelBuilder.Entity<Orders>()
                .Property(e => e.TotalMoney)
                .HasPrecision(19, 4);

            modelBuilder.Entity<Product>()
                .Property(e => e.Name)
                .IsUnicode(false);

            modelBuilder.Entity<Product>()
                .Property(e => e.Remark)
                .IsUnicode(false);

            modelBuilder.Entity<Product>()
                .Property(e => e.Price)
                .HasPrecision(19, 4);

            modelBuilder.Entity<Product>()
                .Property(e => e.PictureUrl)
                .IsUnicode(false);

            modelBuilder.Entity<ProductAttribute>()
                .Property(e => e.Value)
                .IsUnicode(false);

            modelBuilder.Entity<ProductComment>()
                .Property(e => e.Title)
                .IsUnicode(false);

            modelBuilder.Entity<ProductComment>()
                .Property(e => e.Body)
                .IsUnicode(false);

            modelBuilder.Entity<ProductComment>()
                .Property(e => e.Ip)
                .IsUnicode(false);

            modelBuilder.Entity<ProductComment>()
                .Property(e => e.Email)
                .IsUnicode(false);

            modelBuilder.Entity<Userinfo>()
                .Property(e => e.Username)
                .IsUnicode(false);

            modelBuilder.Entity<Userinfo>()
                .Property(e => e.Password)
                .IsUnicode(false);

            modelBuilder.Entity<Userinfo>()
                .Property(e => e.Email)
                .IsUnicode(false);

            modelBuilder.Entity<Userinfo>()
                .Property(e => e.Telephone)
                .IsUnicode(false);

            modelBuilder.Entity<Userinfo>()
                .Property(e => e.Address)
                .IsUnicode(false);

            modelBuilder.Entity<Userinfo>()
                .Property(e => e.Postcode)
                .IsUnicode(false);

            modelBuilder.Entity<Userinfo>()
                .Property(e => e.Remark)
                .IsUnicode(false);
        }

        
    }
}
